import api from '../index'
import tools from '@/tools'
import config from "@/config"

var userId = localStorage.getItem("userId")

// 查询modeler列表
export const listDefinition = (params) => {
	const url = '/vapi/supplier-activity/processDefinition/list'
	return api.get(url, params)
}

// 查询审批详细
export const getDefinitionsByInstanceId = (instanceId) => {
	const url = '/vapi/supplier-activity/processDefinition/getDefinitions/${instanceId}'
	return api.get(url)
}

// 挂起激活转换
export const suspendOrActiveApply = (data) => {
	const url = '/vapi/supplier-activity/processDefinition/suspendOrActiveApply'
	return api.post(url, data)
}

// 删除Modeler
export const delDefinition = (id) => {
	const url = '/vapi/supplier-activity/processDefinition/remove/' + id
	return api.delete(url)
}

//查询审批详细
export const getActivitiDetail = (deploymentId) => {
	const url = '/vapi/supplier-activity/processDefinition/getDefinitionXML?deploymentId=' + deploymentId +
		'&resourceName=.bpmn'
	return api.get(url)
}


//查询该部门下有多少审批流
export const listByOrgId = (supplierId) => {
	const url = '/vapi/supplier-activity/processDefinition/listBySupplierId?supplierId=' + supplierId
	return api.get(url)
}

// 获取负责的供应商列表
export const supplierList = () => {
	const url = `${config.pre}/supplier-activity/workFlow/supplier/list?userId=${userId}`;
	return api.get(url);
}
